package com.jiayang.hhotel.ui;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.util.Log;

import com.jiayang.hhotel.R;
import com.jiayang.hhotel.bean.Constant;
import com.jiayang.hhotel.fragment.DayFragment;

import java.util.ArrayList;
import java.util.List;

import cn.droidlover.xdroidmvp.base.XFragmentAdapter;
import cn.droidlover.xdroidmvp.mvp.XActivity;

/**
 * Created by Administrator on 2017/5/18 0018.
 * 统计分析activity
 */

public class StatisticalActivity extends XActivity {
    private TabLayout tabLayout;
    private ViewPager viewPager;
    private List<Fragment> fragmentList= new ArrayList<>();
    private int mpType;//判断需要请求的数据类型

    @Override
    public void initData(Bundle savedInstanceState) {
        initTitle(this,true,getString(R.string.staticstical_analysis),R.color.orange_color,null,null);

        mpType = getIntent().getIntExtra(Constant.INTENT_PROJECT_KEY,1);

        tabLayout=(TabLayout)findViewById(R.id.tabLayout);
        viewPager=(ViewPager)findViewById(R.id.viewPager);
        fragmentList.clear();
        fragmentList.add(new DayFragment());
        fragmentList.add(new DayFragment());
        fragmentList.add(new DayFragment());

        viewPager.setAdapter(new XFragmentAdapter(getSupportFragmentManager(), fragmentList, getResources().getStringArray(R.array.time_text_list)));
        viewPager.setOffscreenPageLimit(3);
        tabLayout.setupWithViewPager(viewPager);

        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                Log.e("position",tab.getPosition()+"");
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_statistical;
    }

    @Override
    public Object newP() {
        return null;
    }
}
